<template>
  <el-form
    :model="passForm"
    :rules="passRules"
    :disabled="disabled"
    ref="passForm"
    label-width="120px"
  >
    <el-row :gutter="20">
      <el-col :span="24">
        <el-form-item label="密码" prop="password">
          <el-input
            size="small"
            type="password"
            v-model="passForm.password"
            autocomplete="off"
            show-password
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item label="确认密码" prop="checkPass">
          <el-input
            size="small"
            type="password"
            v-model="passForm.checkPass"
            autocomplete="off"
            show-password
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
// import { uploadPrivate, uploadOCRCard } from "@/api/system/oss";

export default {
  props: {
    passForm: Object,
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    const validatePass = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("请输入密码"));
      } else {
        if (this.passForm.checkPass !== "") {
          this.$refs.passForm.validateField("checkPass");
        }
        callback();
      }
    };
    const validatePass2 = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("请再次输入密码"));
      } else if (value !== this.passForm.password) {
        callback(new Error("两次输入密码不一致!"));
      } else {
        callback();
      }
    };
    return {
      passRules: {
        password: [{ required: true, validator: validatePass, trigger: "blur" }],
        checkPass: [{ required: true, validator: validatePass2, trigger: "blur" }],
      },
    };
  },
  methods: {
    
  },
};
</script>

<style>
</style>
